(ns jbtrader.test.registration-story
  (:use conducta.bdd conducta.ui))

(User-story "As a new user, I want to be able to register, so that I can buy a jukebox.")

(defn select-account-information
  "Selects the account information option."
  [registration-tab]
  (select "Account Info" registration-tab)
)

(defn Populate-account-info
    "Populates the account registration forms."  
    [registration-form 
     username password retype-password 
     accessibility-level subscribe usertype]
  
    (select "Account Info" registration-form)
    (enter-text "stoto79" username)
    (enter-text "password123" password)
    (enter-text "password123" retype-password)
    (select "Group" accessibility-level)
    (select subscribe)
    (select "Both" usertype)
)

(defn Populate-jukebox-info
    "Populates user's jukebox preferences"
    [registration-options brands selected-brands brand-selector 
     from-year-selector to-year-selector budget-selector]

    (drag-item "Wurlitzer" brands) (drop-item selected-brands)
    (drag-item "Seeburg" brands) (drop-item selected-brands)
    (drag-item "United" brands) (drop-item selected-brands)
    (select "Mills" brands) (click brand-selector)
    (select "1950" from-year-selector)
    (select "1980" to-year-selector)
    (select "1000" budget-selector)
)

(defn Agree-to-terms-and-conditions
    "Agrees to the terms and conditions of the user registration"
    [registration-options agreement-options register]
  
    (select "Terms and Conditions" registration-options)
    (select "I agree with the terms and conditions" agreement-options)
    (click register)
)
